// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity.p_view;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.*;
import android.view.animation.*;
import android.widget.*;
import com.nnee.p_g.cls_b;

// Referenced classes of package com.nnee.p_pr.p_activity.view:
//            o, bn

public class cls_NPullToFreshContainer extends FrameLayout
    implements android.view.animation.Animation.AnimationListener
{

    public cls_NPullToFreshContainer(Context context)
    {
        super(context);
        b = 0;
        c = 0;
        d = 1;
        e = 2;
        f = 3;
        g = 4;
        h = 0;
        v = true;
        w = 0;
        a(context);
    }

    public cls_NPullToFreshContainer(Context context, AttributeSet attributeset)
    {
        super(context, attributeset);
        b = 0;
        c = 0;
        d = 1;
        e = 2;
        f = 3;
        g = 4;
        h = 0;
        v = true;
        w = 0;
        a(context);
    }

    public cls_NPullToFreshContainer(Context context, AttributeSet attributeset, int i1)
    {
        super(context, attributeset, i1);
        b = 0;
        c = 0;
        d = 1;
        e = 2;
        f = 3;
        g = 4;
        h = 0;
        v = true;
        w = 0;
        a(context);
    }

    static int a(cls_NPullToFreshContainer npulltofreshcontainer, int i1)
    {
        int j1 = i1 + npulltofreshcontainer.p;
        npulltofreshcontainer.p = j1;
        return j1;
    }

    private void a(Context context)
    {
        setDrawingCacheEnabled(false);
        n = LayoutInflater.from(getContext()).inflate(0x7f030016, null);
        n.setVisibility(4);
        n.setBackgroundColor(0xf7f7f8);
        i = (ImageView)n.findViewById(0x7f0d003f);
        i.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);
        float f1 = context.getResources().getDisplayMetrics().density;
        i.setMinimumHeight((int)(f1 * 50F));
        j = (TextView)n.findViewById(0x7f0d0040);
        k = (TextView)n.findViewById(0x7f0d0041);
        k.setVisibility(0);
        q = (ProgressBar)n.findViewById(0x7f0d003e);
        m = new RotateAnimation(0F, -180F, 1, 0.5F, 1, 0.5F);
        m.setInterpolator(new LinearInterpolator());
        m.setDuration(250L);
        m.setFillAfter(true);
        m.setAnimationListener(this);
        l = new RotateAnimation(-180F, 0F, 1, 0.5F, 1, 0.5F);
        l.setInterpolator(new LinearInterpolator());
        l.setDuration(250L);
        l.setFillAfter(true);
        addView(n, new android.view.ViewGroup.LayoutParams(-1, -2));
        t = new cls_o(this);
    }

    static boolean a(cls_NPullToFreshContainer npulltofreshcontainer, boolean flag)
    {
        npulltofreshcontainer.x = flag;
        return flag;
    }

    private void c()
    {
        t.a(-p - b, 250);
    }

    private void d()
    {
        if(p != 0)
            t.a(-p, 250);
    }

    public void a()
    {
        h = 3;
        c();
        b();
    }

    public void a(cls_bn bn1)
    {
        s = bn1;
    }

    public void a(String s1)
    {
        b(s1);
    }

    public void b()
    {
        if(s != null)
            s.a();
    }

    public void b(String s1)
    {
        c(s1);
        if(p != 0)
            d();
        h = 0;
    }

    public void c(String s1)
    {
        if(s1 != null)
            u = s1;
    }

    protected void dispatchDraw(Canvas canvas)
    {
        View view;
        View view1;
        super.dispatchDraw(canvas);
        view = getChildAt(0);
        view1 = getChildAt(1);
        h;
        JVM INSTR tableswitch 0 4: default 56
    //                   0 57
    //                   1 79
    //                   2 79
    //                   3 182
    //                   4 298;
           goto _L1 _L2 _L3 _L3 _L4 _L5
_L1:
        return;
_L2:
        view.setVisibility(4);
        view1.layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
        continue; /* Loop/switch isn't completed */
_L3:
        view.setVisibility(0);
        view1.offsetTopAndBottom(-p - view1.getTop());
        view.setVisibility(0);
        q.setVisibility(4);
        view.offsetTopAndBottom(-b - p - view.getTop());
        if(h == 1)
            j.setText(0x7f0a01fc);
        else
            j.setText(0x7f0a01fb);
        if(u != null)
            k.setText(u);
        continue; /* Loop/switch isn't completed */
_L4:
        view.setVisibility(0);
        view1.offsetTopAndBottom(-p - view1.getTop());
        int j1 = view.getTop();
        view1.layout(view1.getLeft(), view1.getTop(), view1.getRight(), getHeight());
        q.setVisibility(0);
        i.clearAnimation();
        i.setVisibility(4);
        j.setText(0x7f0a01fd);
        if(u != null)
            k.setText(u);
        view.offsetTopAndBottom(-b - p - j1);
        continue; /* Loop/switch isn't completed */
_L5:
        view1.invalidate();
        view1.offsetTopAndBottom(-p - view1.getTop());
        int i1 = view.getTop();
        view1.layout(view1.getLeft(), view1.getTop(), view1.getRight(), getHeight());
        q.setVisibility(0);
        k.setVisibility(0);
        j.setText(0x7f0a01fd);
        view.offsetTopAndBottom(-b - p - i1);
        if(true) goto _L1; else goto _L6
_L6:
    }

    public boolean dispatchTouchEvent(MotionEvent motionevent)
    {
        int i1;
        AdapterView adapterview;
        boolean flag;
        if(x)
        {
            motionevent.setAction(3);
            super.dispatchTouchEvent(motionevent);
            flag = true;
        } else
        {
label0:
            {
                i1 = 0xff & motionevent.getAction();
                adapterview = (AdapterView)getChildAt(1);
                Adapter adapter = adapterview.getAdapter();
                if(adapter != null && adapter.getCount() != 0)
                    break label0;
                flag = true;
            }
        }
_L5:
        return flag;
        float f1;
        f1 = motionevent.getY();
        motionevent.getX();
        i1;
        JVM INSTR tableswitch 0 3: default 112
    //                   0 122
    //                   1 767
    //                   2 153
    //                   3 767;
           goto _L1 _L2 _L3 _L4 _L3
_L1:
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L2:
        o = f1;
        if(r != null)
            r.recycle();
        r = MotionEvent.obtain(motionevent);
          goto _L1
_L4:
        float f2 = o - f1;
        o = f1;
        int k1 = adapterview.getFirstVisiblePosition();
        int j1;
        int l1;
        int i2;
        if(adapterview.getChildCount() > 0)
            l1 = adapterview.getChildAt(0).getTop();
        else
            l1 = 0;
        if(h != 3) goto _L7; else goto _L6
_L6:
        if(r.getY() - f1 > 0F) goto _L9; else goto _L8
_L8:
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L9:
        h = 4;
_L7:
        if(h != 4) goto _L11; else goto _L10
_L10:
        i2 = p + (int)(f2 / 1.7F);
        if(k1 != 0 || p != -b || f2 >= 0F) goto _L13; else goto _L12
_L12:
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L13:
        if(i2 <= -b || i2 >= 0 || p >= 0) goto _L15; else goto _L14
_L14:
        p = i2;
        invalidate();
        flag = true;
          goto _L5
_L15:
        if(i2 <= 0 || p >= 0) goto _L17; else goto _L16
_L16:
        p = 0;
        invalidate();
        flag = true;
          goto _L5
_L17:
        com.nnee.p_g.cls_b.c("dispatchevent", (new StringBuilder()).append("top: ").append(l1).toString());
        if(k1 != 0 || p != 0 || f2 >= 0F || l1 != w) goto _L19; else goto _L18
_L18:
        com.nnee.p_g.cls_b.c("dispatchevent", (new StringBuilder()).append("position == 0 && mPadding == 0 && scrollY < 0:  newPadding: ").append(i2).toString());
        if(i2 >= 0) goto _L21; else goto _L20
_L20:
        p = i2;
        invalidate();
        flag = true;
          goto _L5
_L19:
        if(k1 != 0 || i2 >= 0 || l1 != w) goto _L23; else goto _L22
_L22:
        p = i2;
        invalidate();
        flag = true;
          goto _L5
_L23:
        if(k1 == 0 && i2 > 0)
            p = 0;
_L21:
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L11:
        if(k1 != 0 || (l1 != w || f2 >= 0F) && adapterview.getTop() <= 0) goto _L25; else goto _L24
_L24:
        p = p + (int)f2 / 2;
        if(p > -b && p < 0 && (h == 0 || h == 1 || h == 2))
        {
            q.setVisibility(4);
            i.setVisibility(0);
            if(h == 2)
            {
                i.clearAnimation();
                i.startAnimation(l);
            }
            h = 1;
        } else
        if(p <= -b && h == 1)
        {
            q.setVisibility(4);
            i.setVisibility(0);
            i.clearAnimation();
            i.startAnimation(m);
            h = 2;
        }
        invalidate();
        if(p != 0)
            motionevent.setAction(3);
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L25:
        if(h != 1 && h != 2) goto _L1; else goto _L26
_L26:
        motionevent.setAction(3);
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L3:
        if(adapterview.getFirstVisiblePosition() != 0 || adapterview.getTop() <= 0 || h != 2) goto _L28; else goto _L27
_L27:
        h = 3;
        c();
        b();
        motionevent.setAction(3);
          goto _L1
_L28:
        if(h != 3) goto _L30; else goto _L29
_L29:
        c();
          goto _L1
_L30:
        if(h != 4) goto _L32; else goto _L31
_L31:
        j1 = getChildAt(0).getBottom();
        if(j1 < b) goto _L34; else goto _L33
_L33:
        c();
        motionevent.setAction(3);
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L34:
        if(j1 <= 0 || j1 >= b) goto _L1; else goto _L35
_L35:
        d();
        motionevent.setAction(3);
        flag = super.dispatchTouchEvent(motionevent);
          goto _L5
_L32:
        d();
        h = 0;
          goto _L1
    }

    public void onAnimationEnd(Animation animation)
    {
    }

    public void onAnimationRepeat(Animation animation)
    {
    }

    public void onAnimationStart(Animation animation)
    {
    }

    protected void onLayout(boolean flag, int i1, int j1, int k1, int l1)
    {
        getChildAt(0).layout(0, -b - p, getMeasuredWidth(), -p);
        getChildAt(1).layout(0, -p, getMeasuredWidth(), getMeasuredHeight());
        if(v || b == 0)
        {
            b = getChildAt(0).getMeasuredHeight();
            AdapterView adapterview = (AdapterView)getChildAt(1);
            if(adapterview.getCount() > 0 && adapterview.getChildAt(0) != null)
                w = adapterview.getChildAt(0).getTop();
            v = false;
        }
    }

    protected void onMeasure(int i1, int j1)
    {
        super.onMeasure(i1, j1);
    }

    private static final boolean a;
    private int b;
    private final int c;
    private final int d;
    private final int e;
    private final int f;
    private final int g;
    private int h;
    private ImageView i;
    private TextView j;
    private TextView k;
    private RotateAnimation l;
    private RotateAnimation m;
    private View n;
    private float o;
    private int p;
    private ProgressBar q;
    private MotionEvent r;
    private cls_bn s;
    private o t;
    private String u;
    private boolean v;
    private int w;
    private boolean x;
}
